import com.mochimedia.ui.*;

/**
* ...
* @author $(DefaultUser)
*/

class com.mochimedia.ui.HRule extends Component {
    
    private var _type:String = "hrule";
    
    //
    //
    public function HRule(container:MovieClip, width:Number, position:Position, style:Style) {
        
        init (container, width, position, style);
        
        if (_container != null) create();
        
    }
    
    //
    //
    private function init (container:MovieClip, width:Number, position:Position, style:Style):Void {
        
        super.init(container, position, style);
        
        _width = width;
        _height = Math.max(1, Math.floor(_style.borderWidth * 0.5));
        
    }
    
    //
    //
    public function create ():Void {
        
        super.create();
        
        if (isNaN(_width)) _width = _parentCell.width - _position.margin_left - _position.margin_right;

        DrawingMethods.rect(_mc, true, 0, 0, _parentCell.width - _position.margin_left - _position.margin_right, _height, ColorTools.getTintedColor(_style.borderColor, _style.backgroundColor, 0.85));
        
    }
    
}